package org.example.ch06.service;

import org.apache.ibatis.session.SqlSession;
import org.example.ch06.entity.User;
import org.example.ch06.mapper.UserMapper;
import org.example.ch06.util.MybatisUtils;

/**
 * ClassName: UserService
 * Description:
 *
 * @Author zjl
 * @Create 2025/04/24 11:09
 * @Version 1.0
 */
public class UserService {

    public User getUser(int id) {
        try (SqlSession sqlSession = MybatisUtils.getSqlSession()) {
             return sqlSession.getMapper(UserMapper.class).getUser(id);
        }
    }
}
